/**
 * 
 */
package com.ntv.presentation.spring.web.backoffice;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.ntv.domain.IUser;
import com.ntv.domain.Login;

/**
 *@author Vedamoorthi Vairam
 *@since 08/02/2009
 */
@Controller
@RequestMapping("/backoffice.html")
@SessionAttributes("userSession")
public class BackOfficeHomeController {
	
	private static final String MA_LOGIN= "login";
	
	@RequestMapping(method = RequestMethod.GET)
	public String form(@ModelAttribute(MA_LOGIN) Login  login, HttpServletRequest request) {
		IUser user = (IUser)request.getSession().getAttribute("userSession");
		if (user == null) {
			login.setTarget("backoffice.html");
			return "signin";
		}
		else {
			return "backoffice.login.sucess";
		}
	}
}
